resource "aws_kms_key" "my_keys" {
  for_each                = var.keys_config
  description             = each.value.description
  deletion_window_in_days = each.value.deletion_window_in_days
  policy                  = each.value.policy
  is_enabled              = true
}

resource "aws_kms_alias" "my_aliases" {
  for_each      = var.keys_config
  name          = each.value.alias_name
  target_key_id = aws_kms_key.my_keys[each.key].key_id
}

